<template>
  <div class="app-container">
    <div v-if="branchName" class="branch_title">
      {{ branchName }}
    </div>
    <!--  推荐课程  -->
    <div class="recommend_course" v-loading="recommendLoading">
      <div class="recommend_course_title">
        <div class="text">推荐课程</div>
        <div @click="showDialog = true" class="more">查看详情 ></div>
      </div>
      <div class="scroll_bar" v-horizontal-scroll-drag>
        <div
          @click="routeTo(item)"
          class="course_card"
          v-for="(item, index) in recommendCourseList"
          :key="index"
        >
          <div
            v-if="item.type == 0 || item.type == 1"
            class="tag"
            :class="{ bg_green: item.type == 1, bg_orange: item.type == 0 }"
          >
            {{ item.type == 0 ? '学校推荐' : '分院推荐' }}
          </div>
          <div
            class="buttons"
            v-if="
              $store.getters.curRole == 'schoolAdmin' ||
              ($store.getters.branchId == item.branchId && item.type != 0)
            "
          >
            <div
              v-if="$store.getters.curRole == 'schoolAdmin'"
              @click.stop="handleSure('1', item)"
              class="btn_item"
            >
              置顶
            </div>
            <div
              v-if="$store.getters.curRole == 'schoolAdmin'"
              @click.stop="handleSure('2', item)"
              class="btn_item"
            >
              置底
            </div>
            <div @click.stop="handleSure('3', item)" class="btn_item">移除</div>
          </div>
          <img class="img" :src="item.coursePic" alt="加载失败"/>
          <div class="course_name">
            <span v-if="item.courseType == 3">(工学一体)</span>
            <tooltip
              position="top"
              :text="item.courseName"
              :width="item.courseType == 3 ? 'calc(100% - 80px)' : '100%'"
            />
          </div>
          <div class="branch_name">
            <tooltip position="top" :text="item.branchName" width="100%"/>
          </div>
          <div class="card_bottom">
            <div class="teacher_name">{{ item.principalName }}</div>
            <el-popover placement="bottom" trigger="hover">
              <div class="hover_content">
                <div class="hover_left">
                  <div class="left_label">基础数据</div>
                  <div class="item">
                    <div class="label">题目数：</div>
                    <div class="value">
                      {{
                        item.topicNum
                          ? item.topicNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">考核数：</div>
                    <div class="value">
                      {{
                        item.examPaperNum
                          ? item.examPaperNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">练习数：</div>
                    <div class="value">
                      {{
                        item.practicePaperNum
                          ? item.practicePaperNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
                <div class="hover_left ml20">
                  <div class="left_label">学习数据</div>
                  <div class="item">
                    <div class="label">点击量：</div>
                    <div class="value">
                      {{
                        item.clickNum
                          ? item.clickNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">在学人数：</div>
                    <div class="value">
                      {{
                        item.stuStudyNum
                          ? item.stuStudyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">结课人数：</div>
                    <div class="value">
                      {{
                        item.finishNum
                          ? item.finishNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
                <div class="hover_left ml20">
                  <div class="left_label">考核数据</div>
                  <div class="item">
                    <div class="label">累计考核人次：</div>
                    <div class="value">
                      {{
                        item.examNum ? item.examNum.toLocaleString('en-US') : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">生均考核次数：</div>
                    <div class="value">
                      {{
                        item.avgExamNum
                          ? item.avgExamNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">首考通过率：</div>
                    <div class="value">
                      {{
                        item.firstExamPassingRate
                          ? item.firstExamPassingRate
                          : 0
                      }}%
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">重考人次：</div>
                    <div class="value">
                      {{
                        item.applyNum
                          ? item.applyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">生均重考次数：</div>
                    <div class="value">
                      {{
                        item.avgApplyNum
                          ? item.avgApplyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
              </div>
              <div slot="reference" class="learn_num">
                <img
                  class="icon_task"
                  src="@/assets/images/icon_task.png"
                  alt="加载失败"
                />
                <div class="value">{{ item.examNum }}</div>
              </div>
            </el-popover>
          </div>
        </div>
      </div>
      <div v-if="recommendCourseList.length == 0" class="empty_box">
        <el-empty description="暂无推荐课程"></el-empty>
      </div>
    </div>
    <!--  课程列表  -->
    <div class="course_list" v-loading="loading">
      <div class="title">课程列表</div>
      <div class="search_collect">
        <el-form
          :model="model"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="68px"
        >
          <el-form-item label="">
            <el-input
              v-model="model.courseName"
              placeholder="请输入课程名称"
              clearable
            />
          </el-form-item>
          <el-form-item
            v-if="this.$store.getters.roleId != 'branchAdmin'"
            label=""
          >
            <el-select
              filterable
              v-model="model.branchId"
              placeholder="请选择分院名称"
              clearable
            >
              <el-option
                v-for="item in branchList"
                :key="item.branchId"
                :label="item.branchName"
                :value="item.branchId"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-select
              filterable
              v-model="model.principalId"
              placeholder="请选择主讲教师"
              clearable
            >
              <el-option
                v-for="item in teacherList"
                :key="item.teacherId"
                :label="item.name"
                :value="item.teacherId"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-select
              filterable
              v-model="model.courseType"
              placeholder="请选择课程类型"
              clearable
            >
              <el-option
                v-for="(item, index) of dict.type.course_type"
                :key="index"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-select
              filterable
              v-model="model.courseTemplate"
              placeholder="请选择课程模版"
              clearable
            >
              <el-option label="全部" :value="''"></el-option>
              <el-option label="通用模版" :value="0"></el-option>
              <el-option label="工学一体模版" :value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-select
              filterable
              v-model="model.sortSearch"
              placeholder="请选择排序"
            >
              <el-option
                v-for="item in sortList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button
              v-preventReClick
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleSearch"
            >搜索
            </el-button
            >
            <el-button
              v-preventReClick
              icon="el-icon-refresh"
              size="mini"
              @click="resetSearch"
            >重置
            </el-button
            >
          </el-form-item>
        </el-form>
      </div>
      <div class="course_collect">
        <div
          @click="routeTo(item)"
          class="course_card"
          v-for="(item, index) in courseList"
          :key="index"
        >
          <div v-if="item.hide == 1" class="hide_model"></div>
          <div
            v-if="item.type == 0 || item.type == 1"
            class="tag"
            :class="{ bg_green: item.type == 1, bg_orange: item.type == 0 }"
          >
            {{ item.type == 0 ? '学校推荐' : '分院推荐' }}
          </div>
          <div
            class="buttons"
            v-if="
              item.type != '0' &&
              item.type != '1' &&
              ($store.getters.curRole == 'schoolAdmin' ||
                $store.getters.branchId == item.branchId)
            "
          >
            <div
              v-if="item.hide != 1"
              @click.stop="handleSure('4', item)"
              class="btn_item"
            >
              推荐
            </div>
            <div
              v-if="item.hide != 1"
              @click.stop="handleSure('5', item)"
              class="btn_item"
            >
              隐藏
            </div>
            <div
              v-if="item.hide == 1"
              @click.stop="handleSure('6', item)"
              class="btn_item"
            >
              显示
            </div>
          </div>
          <img class="img" :src="item.coursePic" alt="加载失败"/>
          <div class="course_name">
            <span v-if="item.courseType == 3">(工学一体)</span>
            <tooltip
              position="top"
              :text="item.courseName"
              :width="item.courseType == 3 ? 'calc(100% - 80px)' : '100%'"
            />
          </div>
          <div class="branch_name">
            <tooltip position="top" :text="item.branchName" width="100%"/>
          </div>
          <div class="card_bottom">
            <div class="teacher_name">{{ item.principalName }}</div>
            <el-popover placement="bottom" trigger="hover">
              <div class="hover_content">
                <div class="hover_left">
                  <div class="left_label">基础数据</div>
                  <div class="item">
                    <div class="label">题目数：</div>
                    <div class="value">
                      {{
                        item.topicNum
                          ? item.topicNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">考核数：</div>
                    <div class="value">
                      {{
                        item.examPaperNum
                          ? item.examPaperNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">练习数：</div>
                    <div class="value">
                      {{
                        item.practicePaperNum
                          ? item.practicePaperNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
                <div class="hover_left ml20">
                  <div class="left_label">学习数据</div>
                  <div class="item">
                    <div class="label">点击量：</div>
                    <div class="value">
                      {{
                        item.clickNum
                          ? item.clickNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">在学人数：</div>
                    <div class="value">
                      {{
                        item.stuStudyNum
                          ? item.stuStudyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">结课人数：</div>
                    <div class="value">
                      {{
                        item.finishNum
                          ? item.finishNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
                <div class="hover_left ml20">
                  <div class="left_label">考核数据</div>
                  <div class="item">
                    <div class="label">累计考核人次：</div>
                    <div class="value">
                      {{
                        item.examNum ? item.examNum.toLocaleString('en-US') : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">生均考核次数：</div>
                    <div class="value">
                      {{
                        item.avgExamNum
                          ? item.avgExamNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">首考通过率：</div>
                    <div class="value">
                      {{
                        item.firstExamPassingRate
                          ? item.firstExamPassingRate
                          : 0
                      }}%
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">重考人次：</div>
                    <div class="value">
                      {{
                        item.applyNum
                          ? item.applyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                  <div class="item">
                    <div class="label">生均重考次数：</div>
                    <div class="value">
                      {{
                        item.avgApplyNum
                          ? item.avgApplyNum.toLocaleString('en-US')
                          : 0
                      }}
                    </div>
                  </div>
                </div>
              </div>
              <div slot="reference" class="learn_num">
                <img
                  class="icon_task"
                  src="@/assets/images/icon_task.png"
                  alt="加载失败"
                />
                <div class="value">{{ item.examNum }}</div>
              </div>
            </el-popover>
          </div>
        </div>
      </div>
      <div v-if="courseList.length == 0" class="empty_box">
        <el-empty description="暂无课程"></el-empty>
      </div>
      <pagination
        :total="total"
        :page.sync="model.pageNum"
        :pageSizes="[12, 24, 48, 96]"
        :limit.sync="model.pageSize"
        @pagination="getCourseRecommendCourseList"
      />
    </div>
    <detialDialog
      :open.sync="showDialog"
      @refreshData="getCourseRecommend"
      :root="true"
    ></detialDialog>
  </div>
</template>

<script>
import {
  getCourseRecommend,
  getCourseRecommendCourseList,
  addCourseRecommend,
  editCourseRecommend,
  deleteCourseRecommend,
  needHideCourseRecommend
} from '@/api/home'
import { listPost_teacher } from '@/api/schoolOrganization/teacher'
import { listPost_branch } from '@/api/schoolOrganization/organization'
import detialDialog from './detialDialog'

export default {
  components: { detialDialog },
  name: 'recommendCourse',
  dicts: ['course_type'],
  data() {
    return {
      branchName: '',
      //主讲教师列表
      teacherList: [],
      //分院列表
      branchList: [],
      //课程列表
      courseList: [],
      //推荐课程列表
      recommendCourseList: [],
      showDialog: false,
      loading: false,
      recommendLoading: false,
      total: 0,
      model: {
        courseTemplate: '',
        sortSearch: 9,
        courseType: '',
        principalId: '',
        branchId: '',
        courseName: '',
        pageNum: 1,
        pageSize: 12
      },
      sortList: [
        {
          value: 9,
          label: '综合排序'
        },
        {
          value: 0,
          label: '最新发布时间'
        },
        {
          value: 1,
          label: '累计考核次数(由高到低)'
        },
        {
          value: 2,
          label: '累计考核次数(由低到高)'
        },
        {
          value: 3,
          label: '累计结课人数(由高到低)'
        },
        {
          value: 4,
          label: '累计结课人数(由低到高)'
        },
        {
          value: 5,
          label: '当前在学人数(由高到低)'
        },
        {
          value: 6,
          label: '当前在学人数(由低到高)'
        },
        {
          value: 7,
          label: '课程总点击量(由高到低)'
        },
        {
          value: 8,
          label: '课程总点击量(由低到高)'
        }
      ]
    }
  },
  watch: {
    'model.branchId': {
      handler() {
        this.getTeacher()
      },
      deep: true
    }
  },
  created() {
    if (this.$store.getters.roleId == 'branchAdmin') {
      this.model.branchId = this.$store.getters.branchId
    }
    this.getTeacher()
    this.getBranch()
    this.getCourseRecommend()
    this.getCourseRecommendCourseList()
  },
  mounted() {
  },
  beforeDestroy() {
  },
  methods: {
    routeTo(item) {
      this.$router.push({
        path: '/recommendCourseDetial',
        query: {
          from: 'recommend',
          courseId: item.courseId,
          branchId: item.branchId,
          type: 'detail'
        }
      })
    },
    // 获取教师列表
    getTeacher() {
      listPost_teacher({
        pageNum: 1,
        pageSize: 9999,
        schoolId: this.$store.getters.schoolId,
        branchId: this.model.branchId
      }).then((response) => {
        this.teacherList = response.rows
      })
    },
    getBranch() {
      listPost_branch({
        pageNum: 1,
        pageSize: 9999,
        schoolId: this.$store.getters.schoolId
      }).then((response) => {
        this.branchList = response.rows
        if (this.$store.getters.roleId == 'branchAdmin') {
          for (const row of response.rows) {
            if (this.$store.getters.branchId == row.branchId) {
              this.branchName = row.branchName
            }
          }
        }
      })
    },
    handleSure(type, item) {
      let text = {
        1: `确认将《${item.courseName}》置顶吗？`,
        2: `确认将《${item.courseName}》置底吗？`,
        3: `确认将《${item.courseName}》从推荐课程列表中移除吗？`,
        4: `确认将《${item.courseName}》添加至推荐课程列表中吗？`,
        5: `确认将《${item.courseName}》隐藏吗？`,
        6: `确认将《${item.courseName}》显示吗？`
      }
      let titleText = {
        1: `置顶`,
        2: `置底`,
        3: `移除`,
        4: `推荐`,
        5: `隐藏`,
        6: `显示`
      }
      this.$confirm(text[type], `${titleText[type]}提示`, {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          if (type == 1) {
            this.editCourseRecommend(item, 1)
          }
          if (type == 2) {
            this.editCourseRecommend(item, -1)
          }
          if (type == 3) {
            this.deleteCourseRecommend(item)
          }
          if (type == 4) {
            this.addCourseRecommend(item)
          }
          if (type == 5) {
            this.needHideCourseRecommend(item, 1)
          }
          if (type == 6) {
            this.needHideCourseRecommend(item, 0)
          }
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消操作'
          })
        })
    },
    //置顶&&置底
    async editCourseRecommend(item, type) {
      const loading = this.$loading({
        lock: true,
        text: '正在处理...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      try {
        let params = {
          id: item.id,
          top: type
        }
        let res = await editCourseRecommend(params)
        const { code } = res
        if (code === 200) {
          this.$modal.msgSuccess(`${type == 1 ? '置顶' : '置底'}成功`)
          this.getCourseRecommend()
        }
      } catch (e) {
        console.error(e)
      } finally {
        loading.close()
      }
    },
    // 移除推荐课程
    async deleteCourseRecommend(item) {
      const loading = this.$loading({
        lock: true,
        text: '正在处理...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      try {
        let res = await deleteCourseRecommend(item.id)
        const { code } = res
        if (code === 200) {
          this.$modal.msgSuccess(`移除成功`)
          this.getCourseRecommend()
          this.getCourseRecommendCourseList()
        }
      } catch (e) {
        console.error(e)
      } finally {
        loading.close()
      }
    },
    //推荐课程
    async addCourseRecommend(item) {
      const loading = this.$loading({
        lock: true,
        text: '正在处理...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      try {
        let params = {
          courseId: item.courseId
        }
        let res = await addCourseRecommend(params)
        const { code } = res
        if (code === 200) {
          this.$modal.msgSuccess('推荐成功')
          this.getCourseRecommend()
          this.getCourseRecommendCourseList()
        }
      } catch (e) {
        console.error(e)
      } finally {
        loading.close()
      }
    },
    //隐藏||显示课程
    async needHideCourseRecommend(item, hide) {
      const loading = this.$loading({
        lock: true,
        text: '正在处理...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      try {
        let res = await needHideCourseRecommend(item.courseId, hide)
        const { code } = res
        if (code === 200) {
          this.$modal.msgSuccess(`${hide == 1 ? '隐藏' : '显示'}成功`)
          this.getCourseRecommendCourseList()
        }
      } catch (e) {
        console.error(e)
      } finally {
        loading.close()
      }
    },
    //获取推荐课程列表
    async getCourseRecommend() {
      this.recommendLoading = true
      try {
        let params = {
          pageNum: 1,
          pageSize: 9999
        }
        if (this.$store.getters.roleId == 'branchAdmin') {
          params.branchId = this.$store.getters.branchId
        }
        let res = await getCourseRecommend(params)
        const { code, rows } = res
        if (code === 200) {
          this.recommendLoading = false
          this.recommendCourseList = rows
        }
      } catch (e) {
        console.error(e)
      } finally {
      }
    },
    //获取课程列表
    async getCourseRecommendCourseList() {
      this.loading = true
      try {
        let res = await getCourseRecommendCourseList(this.model)
        const { code, rows, total } = res
        if (code === 200) {
          this.loading = false
          this.total = total
          this.courseList = rows
        }
      } catch (e) {
        console.error(e)
      } finally {
      }
    },
    //搜索
    handleSearch() {
      this.getCourseRecommendCourseList()
    },
    //重置
    resetSearch() {
      this.model = {
        courseTemplate: '',
        sortSearch: 9,
        courseType: '',
        principalId: '',
        branchId: '',
        courseName: '',
        pageNum: 1,
        pageSize: 12
      }
      if (this.$store.getters.roleId == 'branchAdmin') {
        this.model.branchId = this.$store.getters.branchId
      }
      this.getCourseRecommendCourseList()
    }
  }
}
</script>

<style scoped lang="scss">
.app-container {
  width: 100%;
  height: calc(100vh - 100px);
  overflow: auto;

  .recommend_course {
    background: rgba(84, 131, 195, 0.1);
    padding: 21px 20px 10px;
    border-radius: 16px;

    &_title {
      display: flex;
      justify-content: space-between;
      margin-bottom: 24px;

      .text {
        font-family: PingFangSC, PingFang SC, sans-serif;
        font-weight: bold;
        font-size: 18px;
        color: #333333;
        position: relative;
      }

      .more {
        font-family: PingFangSC, PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 14px;
        color: #4a90e2;
        cursor: pointer;
        user-select: none;
      }
    }

    .scroll_bar {
      padding: 0 20px 37px;
      box-sizing: border-box;
      width: 100%;
      overflow-x: auto;
      white-space: nowrap;
      display: flex;

      .course_card {
        flex: 0 0 auto; /* 不拉伸，固定宽度 */
        width: 250px;
        height: 258px;
        background: #ffffff;
        border-radius: 18px;
        border: 1px solid #ebebeb;
        cursor: pointer;
        margin-right: 32px;
        position: relative;

        &:hover {
          .buttons {
            display: block;
          }
        }

        .tag {
          position: absolute;
          top: 0;
          left: 0;
          width: 79px;
          height: 23px;
          border-radius: 9px 0 9px 0;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 600;
          font-size: 16px;
          color: #ffffff;
          text-align: center;
        }

        .buttons {
          display: none;
          position: absolute;
          right: 14px;
          top: 8px;

          .btn_item {
            width: 40px;
            height: 16px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 9px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: PingFangSC, PingFang SC, sans-serif;
            font-weight: 400;
            font-size: 12px;
            color: #050505;
            user-select: none;
            cursor: pointer;
            margin-bottom: 8px;

            &:active {
              background: darken(rgba(255, 255, 255, 0.8), 10%);
              color: darken(#050505, 18%);
            }
          }
        }

        .img {
          width: 100%;
          height: 156px;
          background: #24044e;
          border-radius: 9px 9px 0 0;
        }

        .course_name {
          padding: 0 0 0 12px;
          box-sizing: border-box;
          margin-top: 4px;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 600;
          font-size: 17px;
          color: #333333;

          span {
            font-weight: 500;
            font-size: 12px;
            color: #f89a33;
            margin-right: 6px;
          }
        }

        .branch_name {
          margin-top: 4px;
          padding: 0 12px 0 12px;
          box-sizing: border-box;
          line-height: 20px;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 400;
          font-size: 14px;
          color: #999999;
        }

        .card_bottom {
          margin-top: 4px;
          line-height: 22px;
          padding: 0 12px 0 12px;
          box-sizing: border-box;
          display: flex;
          justify-content: space-between;
          align-items: center;

          .teacher_name {
            font-family: PingFangSC, PingFang SC, sans-serif;
            font-weight: 400;
            font-size: 13px;
            color: #999999;
          }

          .learn_num {
            display: flex;
            align-items: center;

            .icon_task {
              width: 16px;
            }

            .value {
              margin-left: 4px;
              font-family: PingFangSC, PingFang SC, sans-serif;
              font-weight: 400;
              font-size: 13px;
              color: #999999;
            }
          }
        }
      }

      .course_card:last-child {
        margin-right: 0;
      }
    }

    /* 滚动条样式 */
    .scroll_bar::-webkit-scrollbar {
      height: 6px; /* 滚动条宽度 */
    }

    .scroll_bar::-webkit-scrollbar-track {
      background: transparent;
    }

    .scroll_bar::-webkit-scrollbar-thumb {
      background: #ccdcf3; /* 滚动条thumb颜色 */
      border-radius: 5px; /* 滚动条thumb圆角 */
    }
  }

  .course_list {
    padding: 22px;
    box-sizing: border-box;
    margin-top: 20px;
    width: 100%;
    min-height: 748px;
    background: #ffffff;
    box-shadow: 0 0 10px 0 rgba(0, 74, 88, 0.06);
    border-radius: 16px;

    .title {
      font-family: PingFangSC, PingFang SC, sans-serif;
      font-weight: bold;
      font-size: 18px;
      color: #333333;
    }

    .search_collect {
      display: flex;
      align-items: center;
      margin-top: 20px;
      padding: 0 20px;
      box-sizing: border-box;
    }

    .course_collect {
      width: 100%;
      padding: 0 20px;
      box-sizing: border-box;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
      grid-gap: 20px;
      justify-content: center;

      .course_card {
        flex: 0 0 auto; /* 不拉伸，固定宽度 */
        width: 228px;
        height: 242px;
        background: #ffffff;
        border-radius: 18px;
        border: 1px solid #ebebeb;
        cursor: pointer;
        margin: 0 20px 24px 0;
        position: relative;

        .hide_model {
          position: absolute;
          width: 228px;
          height: 242px;
          border-radius: 18px;
          background: rgba(0, 0, 0, 0.4);
          border: 1px solid rgba(235, 235, 235, 0.4);
        }

        &:hover {
          .buttons {
            display: block;
          }
        }

        .tag {
          position: absolute;
          top: 0;
          left: 0;
          width: 72px;
          height: 21px;
          border-radius: 9px 0 9px 0;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 600;
          font-size: 14px;
          color: #ffffff;
          text-align: center;
        }

        .buttons {
          display: none;
          position: absolute;
          right: 14px;
          top: 8px;

          .btn_item {
            width: 40px;
            height: 16px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 9px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: PingFangSC, PingFang SC, sans-serif;
            font-weight: 400;
            font-size: 12px;
            color: #050505;
            user-select: none;
            cursor: pointer;
            margin-bottom: 8px;

            &:active {
              background: darken(rgba(255, 255, 255, 0.8), 10%);
              color: darken(#050505, 18%);
            }
          }
        }

        .img {
          width: 100%;
          height: 156px;
          background: #24044e;
          border-radius: 18px 18px 0 0;
        }

        .course_name {
          margin-top: 4px;
          padding: 0 0 0 12px;
          box-sizing: border-box;
          line-height: 22px;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 600;
          font-size: 17px;
          color: #333333;

          span {
            font-weight: 500;
            font-size: 12px;
            color: #f89a33;
            margin-right: 6px;
          }
        }

        .branch_name {
          padding: 0 12px 0 12px;
          box-sizing: border-box;
          font-family: PingFangSC, PingFang SC, sans-serif;
          font-weight: 400;
          font-size: 14px;
          line-height: 20px;
          color: #999999;
        }

        .card_bottom {
          line-height: 22px;
          padding: 0 12px 0 12px;
          box-sizing: border-box;
          display: flex;
          justify-content: space-between;
          align-items: center;

          .teacher_name {
            font-family: PingFangSC, PingFang SC, sans-serif;
            font-weight: 400;
            font-size: 13px;
            color: #999999;
          }

          .learn_num {
            display: flex;
            align-items: center;

            .icon_task {
              width: 16px;
            }

            .value {
              margin-left: 4px;
              font-family: PingFangSC, PingFang SC, sans-serif;
              font-weight: 400;
              font-size: 13px;
              color: #999999;
            }
          }
        }
      }
    }
  }
}

.bg_orange {
  background: #f89a33;
}

.bg_green {
  background: #11a983;
}

::v-deep .el-popover .el-popper {
  background: #ffffff;
  box-shadow: 0 0 20px 0 rgba(0, 74, 88, 0.1);
  border-radius: 8px !important;
  padding: 12px 16px;
  box-sizing: border-box;
}

.hover_content {
  display: flex;
  padding: 16px;
  box-sizing: border-box;

  .hover_left {
    .left_label {
      font-size: 18px;
      color: #1ab394;
      font-weight: bold;
    }

    .item {
      display: flex;
      align-items: center;
      padding: 6px 12px;
      box-sizing: border-box;

      .label {
        font-family: PingFangSC, PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 14px;
        color: #999999;
      }

      .value {
        font-family: PingFangSC, PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 14px;
        color: #333333;
      }
    }

    .item:first-child {
      margin-top: 0;
    }
  }
}

.empty_box {
  width: 100%;
  display: flex;
  justify-content: center;
}

.branch_title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
}
</style>

